#include <cstdio>
#include <iostream>
using namespace std;

int m[20][20], n;
bool p[20];

double dfs(int x) { 
    if (x + 1 == n) { 
        int a = 0, b = 0, c, d;
        for (int i = 1; i <= n && !b; i++)
            if (p[i]) continue;
            else if (!a) a = m[x][i], c = m[x + 1][i];
            else b = m[x][i], d = m[x + 1][i];
        return a * d - b * c;
    }
    double sum = 0, tmp;
    bool now = 1;
    for (int i = 1; i <= n; i++) { 
        if (p[i]) continue;
        p[i] = 1;
        tmp = dfs(x + 1);
        sum += (now ? 1 : -1) * m[x][i] * tmp;
        now = !now;
        p[i] = false;
    }
    return sum;
}

int main() { 
    ios::sync_with_stdio(false);
    cin >> n;
    for(int i = 1; i <= n; i++) { 
        for(int j = 1; j <= n; j++) { 
            cin >> m[i][j];
        }
    }
    cout << dfs(1);
}
